package com.appistry.maven.plugin.far.remote.ssh;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class SshCommandIT {

	private Ssh ssh;
	private SshConfig sshConfig;
	private Command command;

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void sendCommandSuccess() throws Exception {
		sshConfig = new SshConfig(SshConstants.HOST, SshConstants.PORT,
				new SshUserInfo(SshConstants.USER, SshConstants.PASSWORD, true));
		ssh = new Ssh();
		ssh.setSshConfig(sshConfig);
		ssh.setCommand("ls");

		command = new SshCommand(ssh);
		command.execute();
		assertEquals(0, ((SshCommand) command).getRemoteOperation()
				.getDelegate().getExitStatus());

	}

}
